<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    313. Super Ugly Number
   </h1>
   <p>
    Write a program to find the
    <code>
     n
     <sup>
      th
     </sup>
    </code>
    super ugly number.
   </p>
   <p>
    Super ugly numbers are positive numbers whose all prime factors are in the given prime list
    <code>
     primes
    </code>
    of size
    <code>
     k
    </code>
    .
   </p>
   <p>
    <b>
     Example:
    </b>
   </p>
   <pre>
<b>Input:</b> n = 12, <code>primes</code> = <code>[2,7,13,19]</code>
<b>Output:</b> 32 
<strong>Explanation: </strong><code>[1,2,4,7,8,13,14,16,19,26,28,32] </code>is the sequence of the first 12 
             super ugly numbers given <code>primes</code> = <code>[2,7,13,19]</code> of size 4.</pre>
   <p>
    <b>
     Note:
    </b>
   </p>
   <ul>
    <li>
     <code>
      1
     </code>
     is a super ugly number for any given
     <code>
      primes
     </code>
     .
    </li>
    <li>
     The given numbers in
     <code>
      primes
     </code>
     are in ascending order.
    </li>
    <li>
     0 &lt;
     <code>
      k
     </code>
     &le; 100, 0 &lt;
     <code>
      n
     </code>
     &le; 10
     <sup>
      6
     </sup>
     , 0 &lt;
     <code>
      primes[i]
     </code>
     &lt; 1000.
    </li>
    <li>
     The n
     <sup>
      th
     </sup>
     super ugly number is guaranteed to fit in a 32-bit signed integer.
    </li>
   </ul>
  </div>
  <div>
   <h1 class="question_title">
    313. 超级丑数
   </h1>
   <p>
    编写一段程序来查找第
    <code>
     <em>
      n
     </em>
    </code>
    个超级丑数。
   </p>
   <p>
    超级丑数是指其所有质因数都是长度为&nbsp;
    <code>
     k
    </code>
    &nbsp;的质数列表&nbsp;
    <code>
     primes
    </code>
    &nbsp;中的正整数。
   </p>
   <p>
    <strong>
     示例:
    </strong>
   </p>
   <pre><strong>输入:</strong> n = 12, <code>primes</code> = <code>[2,7,13,19]</code>
<strong>输出:</strong> 32 
<strong>解释: </strong>给定长度为 4 的质数列表 primes = [2,7,13,19]，前 12 个超级丑数序列为：[1,2,4,7,8,13,14,16,19,26,28,32] 。</pre>
   <p>
    <strong>
     说明:
    </strong>
   </p>
   <ul>
    <li>
     <code>
      1
     </code>
     &nbsp;是任何给定&nbsp;
     <code>
      primes
     </code>
     &nbsp;的超级丑数。
    </li>
    <li>
     &nbsp;给定&nbsp;
     <code>
      primes
     </code>
     &nbsp;中的数字以升序排列。
    </li>
    <li>
     0 &lt;
     <code>
      k
     </code>
     &le; 100, 0 &lt;
     <code>
      n
     </code>
     &le; 10
     <sup>
      6
     </sup>
     , 0 &lt;
     <code>
      primes[i]
     </code>
     &lt; 1000 。
    </li>
    <li>
     第&nbsp;
     <code>
      n
     </code>
     &nbsp;个超级丑数确保在 32 位有符整数范围内。
    </li>
   </ul>
  </div>
 </body>
</html>